prefix="[script]"
filename=""

check_and_open_file() {
    local file=$1
    if [[ -e $file ]]; then
        xdg-open $file
    else
        echo -e "$prefix $file not found.\n"
    fi
}

echo -e "$prefix start testing:  list factory.\n"
filename="ListPage.html"
./exe_abs_factory -l
check_and_open_file "$filename"

sleep 2s

echo -e "$prefix start testing:  table factory.\n"
filename="TablePage.html"
./exe_abs_factory -t
check_and_open_file "$filename"
